﻿using System;
using System.Collections.Generic;
using ProtoBuf;

namespace Wise.TimeWarrior.DTO
{

    /// <summary>
    /// User Event Data Object
    /// </summary>
    [ProtoContract]
    [Serializable]
    public class UserEventDto
    {
        /// <summary>
        /// When Event Occurs
        /// </summary>

        [ProtoMember(1)]
        public DateTime EventDate { get; set; }
        /// <summary>
        /// Event Type
        /// </summary>

        [ProtoMember(2)]
        public SessionSwitchReasonExtended UserAction { get; set; }
        /// <summary>
        /// Process list opened when event occurs
        /// </summary>

        [ProtoMember(3)]
        public List<ProcessDto> ProcessList { get; set; }
        /// <summary>
        /// .ctor
        /// </summary>
        /// <param name="eventDate">EventDate</param>
        /// <param name="action">UserAction</param>
        /// <param name="processDtos">ProcessList</param>
        public static UserEventDto Create(DateTime eventDate, SessionSwitchReasonExtended action, List<ProcessDto> processDtos)
        {
            return new UserEventDto
            {
                ProcessList = processDtos,
                EventDate = eventDate,
                UserAction = action
            };
        }
    }
}
